package com.dmn.gcode.springchains.operators;

import com.dmn.gcode.springchains.core.AbstractOperator;
import com.dmn.gcode.springchains.core.IChainMaster;
import com.dmn.gcode.springchains.core.In;

import java.util.List;

/**
 * date 1/21/11
 *
 * @author dvponomarev
 * @version 1.0
 */
public class SumOperator extends AbstractOperator {
    //in
    private In<List<Integer>> values;

    public void execute(IChainMaster chainMaster) throws Throwable {
        int sum = 0;
        for (Integer value : values.get()) {
            sum+=value;
        }
        System.out.println(sum);
    }

    public void setValues(In<List<Integer>> values) {
        this.values = values;
    }
}
